import React from 'react'
import $axios from '@/plugins/request'
import {
  message,
  Form,
  Input,
  Button,
  Radio,
  Select,
  Cascader,
  DatePicker,
  InputNumber,
  TreeSelect,
  Switch,
  Rate,
} from 'antd';
import UserForm from './UserForm'

class Edit extends React.Component {
  state = {
    data: {}
  }

  getData = async () => {
    const { id } = this.props.match.params;
    const { data: res } = await $axios.get(`/api/users/${id}`)
    this.setState({ data: res.data })
  }

  componentDidMount() {
    this.getData();
  }

  render() {
    return <UserForm data={this.state.data} />
  }
}
export default Edit;